package com.tangyuan.userauth.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangyuan.common.enums.Genre;
import com.tangyuan.common.result.Result;
import com.tangyuan.common.result.ResultCodeEnum;
import com.tangyuan.model.UserLike;
import com.tangyuan.model.UserVideoCollection;
import com.tangyuan.userauth.mapper.UserLikeMapper;
import com.tangyuan.userauth.service.UserLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 小梁
 * @since 2020-12-03
 */
@Service
public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> implements UserLikeService {
    @Autowired
    UserLikeMapper userLikeMapper;


    /**
     * 插入一条潜在因子记录到userLike
     *
     * @param userId
     * @return 1成功 0失败
     */
    @Override
    public int addUser(Long userId) {
        UserLike userLike = new UserLike(userId);
        return userLikeMapper.insert(userLike);
    }

    /**
     * 得到所有的UserLike信息
     *
     * @return List<UserLike>
     */
    @Override
    public List<UserLike> getUserLikeList() {
        return userLikeMapper.selectList(new QueryWrapper<UserLike>().orderByAsc("user_id"));
    }

}
